package com.wdl.fmnew.app.demo;


import android.widget.TextView;
import android.widget.Toast;

import com.wdl.fmnew.R;
import com.wdl.fmnew.core.base.BaseActivity;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.OnClick;

public class MainActivity extends BaseActivity implements DemoContract.View {

    @BindView(R.id.showData)
    TextView tv_data;

    @Inject
    DemoContract.Presenter presenter;

    @Override
    protected int getContentView() {
        return R.layout.activity_main;
    }

    @Override
    protected void loadView() {

    }

    @OnClick(R.id.click_getData)
    public void getData() {
//        Toast.makeText(this, "getData", Toast.LENGTH_SHORT).show();
//        presenter.refreshData();
        presenter.mn();
    }

    @OnClick(R.id.click_close)
    public void close() {
//        Toast.makeText(this, "getData", Toast.LENGTH_SHORT).show();
//        presenter.refreshData();
        finish();
    }


    @Override
    public void showTip(String tip) {
        Toast.makeText(this, tip, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showData(String msg) {
        tv_data.setText(msg);
    }

    @Override
    protected void onResume() {
        super.onResume();
        presenter.takeView(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.dropView();
        System.out.println("mainactivity destory");
    }
}
